﻿Imports System.IO
Public Class sidebar
    Dim spaceP As Integer
    Private Sub sidebar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        On Error Resume Next
        Timer1.Enabled = True
        Timer1.Interval = 100
        Timer2.Enabled = False  ' for now
        Timer2.Interval = 1000
        If Main.Visible Then
            Exit Sub
        Else
            Me.Visible = True
        End If
        Dim x As Integer
        Dim y As Integer
        x = Screen.PrimaryScreen.WorkingArea.Width
        y = Screen.PrimaryScreen.WorkingArea.Height - Me.Height

        Do Until x = Screen.PrimaryScreen.WorkingArea.Width - Me.Width
            x = x - 1
            Me.Location = New Point(x)
        Loop
        spaceP = 0

        'classlist()
        If Err.Number <> 0 Then
            MsgBox("AHHHHHHH! ERROR! ERROR! - " & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, "DRSS Homework Manager")
        End If
    End Sub
    Public Sub classlist()
        On Error Resume Next

        'Dim currenttime As String
        'currenttime = Val(My.Computer.Clock.LocalTime.Hour.ToString) + Val(My.Computer.Clock.LocalTime.Minute.ToString)
        ''Class Space 1
        'If Val(My.Settings.t1a.ToString) + Val(My.Settings.t1b.ToString) > Val(currenttime) Then

        '    Label1.Text = My.Settings.class1
        'Else
        'End If

        'If Val(My.Settings.t2a.ToString) > Val(currenttime) Then
        '    If Val(My.Settings.t2b.ToString) < Val(currenttime) Then
        '        Label1.Text = My.Settings.class2
        '    End If
        'Else
        'End If
        ''Class Space 2
        'If Val(My.Settings.t2a.ToString) + Val(My.Settings.t2b.ToString) > Val(currenttime) Then

        '    Label1.Text = My.Settings.class2
        'End If

        'If Val(My.Settings.t2a.ToString) > Val(currenttime) Then
        '    If Val(My.Settings.t2b.ToString) < Val(currenttime) Then
        '        Label1.Text = My.Settings.class2
        '    End If
        'Else
        'End If
        ''Error Catch:
        'If Label1.Text = "Label1" Then
        '    Label1.Text = "Error"
        'End If
        If Err.Number <> 0 Then
            MsgBox("Error: " & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, "DRSS Homework Manager")
        End If
    End Sub
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        'If MousePosition.X >= 122 Then
        '    slideout()

        'End If
        'If MousePosition.X <= 122 Then
        '    slidein()

        'End If
    End Sub
    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs)
        KHM.Main.Button7_Click(sender, New System.EventArgs())
    End Sub
    Private Sub slideout()
        'Dim x As Integer
        'Dim y As Integer
        'x = Screen.PrimaryScreen.WorkingArea.Width
        'y = Screen.PrimaryScreen.WorkingArea.Height - Me.Height

        'Do Until x = Screen.PrimaryScreen.WorkingArea.Width - Me.Width + 122
        '    x = x - 1
        '    Me.Location = New Point(x)
        'Loop
    End Sub
    Private Sub slidein()
        'Dim x As Integer
        'Dim y As Integer
        'x = Screen.PrimaryScreen.WorkingArea.Width
        'y = Screen.PrimaryScreen.WorkingArea.Height - Me.Height

        'Do Until x = Screen.PrimaryScreen.WorkingArea.Width - Me.Width - 122
        '    x = x - 1
        '    Me.Location = New Point(x)
        'Loop
    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        On Error Resume Next
        Dim url As String = "https://gb.mdeca.org/ParentAccess/"
        Process.Start(url)
        Me.TopMost = False
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
        On Error Resume Next
        Dim url As String = "https://pilot.wright.edu"
        Process.Start(url)
        Me.TopMost = False
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles Button6.Click
        On Error Resume Next
        Dim url As String = "https://wings.wright.edu"
        Process.Start(url)
        Me.TopMost = False
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button9_Click(sender As System.Object, e As System.EventArgs) Handles Button9.Click
        On Error Resume Next
        

        If TextBox1.Visible = True Then
            If TextBox1.Text <> "" Then
                Dim url As String = "http://www.bing.com/search?q=" + TextBox1.Text
                Process.Start(url)
                TextBox1.Hide()
            Else
                TextBox1.Hide()
                Exit Sub
            End If

        Else
            TextBox1.Visible = True
            TextBox1.Text = ""
            TextBox1.Focus()
        End If
        Me.TopMost = False
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Main.Show()
        If Main.WindowState = FormWindowState.Minimized Then
            Main.WindowState = FormWindowState.Maximized
        End If
        Me.TopMost = False
        topdown.Hide()
        Me.Close()
    End Sub

    Private Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Integer) As Integer


    Private Sub keys_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If (e.Alt AndAlso (e.KeyCode = Keys.S)) Then
            Me.Button9.PerformClick()
        End If

    End Sub

    

    Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click
        
        topdownHideShow()
    End Sub
    Public Sub topdownHideShow()
        If topdown.Visible = True Then
            topdown.Close()
            Me.TopMost = False
        Else
            topdown.Show()
            Me.TopMost = True
        End If
    End Sub
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

    End Sub
End Class
'    This program is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.

'    This program is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.

'    You should have received a copy of the GNU General Public License
'    along with this program.  If not, see <http://www.gnu.org/licenses/>